{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 发现异常值"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "要处理异常值首先要发现异常值，发现异常值的方式主要有以下三种：  \n",
    "- 业务经验：  \n",
    "根据业务经验划定不同指标的正常范围，超过该范围的值算作异常值。  \n",
    "- 箱形图：  \n",
    "通过绘制箱形图，把大于（小于）箱形图上边缘（下边缘）的点称为异常值。  \n",
    "- 3σ 原则：  \n",
    "如果数据服从正态分布，则可以利用3σ 原则，如果一个数值与平均值之间的偏差超过3倍标准差，那么我们就认为这个值是异常值。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![jupyter](https://uploadfiles.nowcoder.com/images/20190612/3230960_1560302134249_4B576ECFA22715AD290D0D37B749DD25)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下图是正态分布图，大于μ+3σ的值为异常值。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![jupyter](https://uploadfiles.nowcoder.com/images/20190612/3230960_1560302098123_01A9C11831DEEB4EEFC74E2DD19B18F6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 处理异常值"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对异常值，一般有以下几种处理方式：  \n",
    "- 过滤：最常用；  \n",
    "- 替换：把异常值当作缺失值来填充。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 过滤掉异常值，保留正常值：  \n",
    "   如，把年龄大于100的值过滤掉，筛选出年龄小于100新表。  \n",
    "\n",
    "- 使用replace()方法替换掉异常值。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
